﻿<ResourceDictionary 
    x:Class="Poet.Resources.XamlStore"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:views="clr-namespace:Poet.Views">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Styles.xaml"/>
        <ResourceDictionary Source="Converters.xaml" />
        <ResourceDictionary Source="DataProviders.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <XamlCollection x:Shared="False" x:Key="SearchMenuItems">
        <MenuItem Header="{Localizing Find}" Command="ApplicationCommands.Find"/>
        <MenuItem Header="{Localizing Replace}" Command="ApplicationCommands.Replace"/>
    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="WebMenuItems">
        <MenuItem Header="{Localizing Search}" Command="ApplicationCommands.Find" CommandParameter="Search" InputGestureText="Ctrl+W"/>
        <MenuItem Header="{Localizing Translate}" Command="ApplicationCommands.Find" CommandParameter="Translate" InputGestureText="Ctrl+T"/>
    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="PrintMenuItems">
        <MenuItem Header="{Localizing PageSetup}" Command="ApplicationCommands.Print" CommandParameter="PageSetup" InputGestureText="Ctrl+L" Icon="{Picture PageSetup}"/>
        <MenuItem Header="{Localizing PrintPreview}" Command="ApplicationCommands.PrintPreview" CommandParameter="Preview" Icon="{Picture PrintPreview}"/>
        <MenuItem Header="{Localizing Print}" Command="ApplicationCommands.Print" Icon="{Picture Print}"/>
    </XamlCollection>

    <XamlCollection x:Key="Tools">
        <DockableContent Title="{Localizing Search}" Name="SearchAndReplaceView" Icon="/Poet;component/Resources/IconSet/Search.png" VerticalContentAlignment="Stretch">
            <DockableContent.Content>
                <views:SearchTabbedView VerticalAlignment="Stretch"/>
            </DockableContent.Content>
        </DockableContent>
        <DockableContent Title="{Localizing Font}" Name="FontView" Icon="/Poet;component/Resources/IconSet/Font.png">
            <DockableContent.Content>
                <views:FontSetView/>
            </DockableContent.Content>
        </DockableContent>
        <DockableContent Title="{Localizing Palette}" Name="PaletteView" Icon="/Poet;component/Resources/IconSet/Palette.png">
            <DockableContent.Content>
                <views:PaletteSetView/>
            </DockableContent.Content>
        </DockableContent>
        <DockableContent Title="{Localizing Format}" Name="EditorView" Icon="/Poet;component/Resources/IconSet/blue-document-text.png">
            <DockableContent.Content>
                <views:FormatSetView/>
            </DockableContent.Content>
        </DockableContent>
    </XamlCollection>

    <XamlCollection x:Key="Plugins">
        <DockableContent Title="{Localizing RegexBuilder}" Icon="/Poet;component/Resources/IconSet/graduation-hat.png">
            <DockableContent.Content>
                <views:RegexBuilderView/>
            </DockableContent.Content>
        </DockableContent>
        <DockableContent Title="{Localizing Rhymer}" Icon="/Poet;component/Resources/IconSet/cup.png">
            <DockableContent.Content>
                <views:RhymerView/>
            </DockableContent.Content>
        </DockableContent>
        <DockableContent Title="{Localizing Statistics}" Icon="/Poet;component/Resources/IconSet/abacus.png">
            <DockableContent.Content>
                <views:StatisticsView/>
            </DockableContent.Content>
        </DockableContent>
    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="TextEditorOptionsToolBarCollection">
        <CheckBox IsChecked="{Binding ShowLineNumbers}" Content="#" ToolTip="{Localizing LineNumber}"/>
        <CheckBox IsChecked="{Binding TextArea.ShowCurrentLine}" Content="~" ToolTip="{Localizing CurrentLine}"/>
        <CheckBox 
            Visibility="{Binding TextArea.ShowCurrentLine, Converter={StaticResource BooleanToVisibilityConverter}}"
            IsChecked="{Binding TextArea.HideCurrentLineWhenTextSelected}" 
            Content="+" 
            ToolTip="{Localizing HideCurrentLineWhenTextSelected}"/>
        <CheckBox IsChecked="{Binding Options.ShowTabs}" Content="»" ToolTip="{Localizing Tab}"/>
        <CheckBox IsChecked="{Binding Options.ShowSpaces}" Content="•" ToolTip="{Localizing Space}"/>
        <CheckBox IsChecked="{Binding Options.ShowBoxForControlCharacters}" Content="♥" ToolTip="{Localizing BoxForControlCharacters}"/>
        <CheckBox IsChecked="{Binding Options.ShowEndOfLine}" Content="¶" ToolTip="{Localizing EndOfLine}"/>
        <CheckBox IsChecked="{Binding WordWrap}" Content="{Picture WordWrap}" ToolTip="{Localizing WordWrap}"/>
    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="CommonToolBarCollection1">
        <CheckBox IsChecked="{Binding ShowLineNumbers}" Content="{Localizing LineNumber}"/>
        <CheckBox IsChecked="{Binding TextArea.ShowCurrentLine}" Content="{Localizing CurrentLine}"/>
        <CheckBox 
            IsEnabled="{Binding TextArea.ShowCurrentLine, Converter={StaticResource BooleanToVisibilityConverter}}"
            IsChecked="{Binding TextArea.HideCurrentLineWhenTextSelected}"
            Content="{Localizing HideCurrentLineWhenTextSelected}"/>
        <CheckBox IsChecked="{Binding Options.ShowTabs}" Content="{Localizing Tab}"/>
        <CheckBox IsChecked="{Binding Options.ShowSpaces}" Content="{Localizing Space}"/>
        <CheckBox IsChecked="{Binding Options.ShowBoxForControlCharacters}" Content="{Localizing BoxForControlCharacters}"/>
        <CheckBox IsChecked="{Binding Options.ShowEndOfLine}" Content="{Localizing EndOfLine}"/>
        <CheckBox IsChecked="{Binding WordWrap}" Content="{Localizing WordWrap}"/>
        <Separator/>
    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="ExtensionsToolBarCollection">
        <CheckBox IsChecked="{Binding UseFolding}" Content="{Picture folding-fan}" ToolTip="{Localizing TextFold}" Visibility="{Binding Syntax, Converter={StaticResource NullToVisibilityConverter}}"/>
        <CheckBox IsChecked="{Binding CloseBrackets}" Content='{}{ }' ToolTip="{Localizing BracketComplete}"/>
        <CheckBox IsChecked="{Binding UseAutocomplete}"  Content="{Picture spell-check}" ToolTip="{Localizing WordComplete}"/>
        <CheckBox IsChecked="{Binding UseSpell}"  Content="{Picture spell-check-error}" ToolTip="{Localizing SpellCheck}"/>
        <CheckBox IsChecked="{Binding UseHighlighting}" Content="{Picture highlighter-text}" ToolTip="{Localizing SyntaxHighlight}" Visibility="{Binding Syntax, Converter={StaticResource NullToVisibilityConverter}}"/>
        <Separator/>
        <CheckBox IsChecked="{Binding DetectSyntax}" Content="D" ToolTip="{Localizing DetectSyntax}"/>
        <ComboBox          
            Name="ComboBox" 
            FontSize="11"
            MinWidth="32"
            IsEditable="True"
            ToolTip="{Localizing Syntax}"
            Text="{Binding Syntax, Converter={StaticResource SyntaxToStringConverter}}"
            SelectedItem="{Binding Syntax}"
            ItemsSource="{Binding Syntaxes}"/>
    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="CommonToolBarCollection2">
        <CheckBox IsChecked="{Binding UseFolding}" Content="{Localizing TextFold}" IsEnabled="{Binding Syntax, Converter={StaticResource NullToBooleanConverter}}"/>
        <CheckBox IsChecked="{Binding CloseBrackets}" Content="{Localizing BracketComplete}"/>
        <CheckBox IsChecked="{Binding UseAutocomplete}"  Content="{Localizing WordComplete}"/>
        <CheckBox IsChecked="{Binding UseSpell}"  Content="{Localizing SpellCheck}"/>
        <CheckBox IsChecked="{Binding UseHighlighting}" Content="{Localizing SyntaxHighlight}" IsEnabled="{Binding Syntax, Converter={StaticResource NullToBooleanConverter}}"/>
        <Separator/>
        <StackPanel Orientation="Horizontal">
            <ComboBox      
                MinWidth="32"
                ToolTip="{Localizing Syntax}"
                IsEditable="True"
                Text="{Binding Syntax, Converter={StaticResource SyntaxToStringConverter}}"
                SelectedItem="{Binding Syntax}"
                ItemsSource="{Binding Syntaxes}"/>
            <ToggleButton IsChecked="{Binding DetectSyntax}" Content="{Localizing Auto}" ToolTip="{Localizing DetectSyntax}"/>
        </StackPanel>
        <Separator/>
    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="ShellStandartToolBarItems">
        <Button Command="ApplicationCommands.New" Content="{Picture New}" ToolTip="{Localizing New}"/>
        <Button Command="ApplicationCommands.Open" Content="{Picture Open}" ToolTip="{Localizing Open}"/>
        <Button Command="ApplicationCommands.Save" Content="{Picture Save}" ToolTip="{Localizing Save}"/>
        <Button Command="ApplicationCommands.Save" CommandParameter="All" Content="{Picture SaveAll}" ToolTip="{Localizing SaveAll}"/>
        <Separator/>
        <Button Command="ApplicationCommands.Cut" Content="{Picture Cut}" ToolTip="{Localizing Cut}"/>
        <Button Command="ApplicationCommands.Copy" Content="{Picture Copy}" ToolTip="{Localizing Copy}"/>
        <Button Command="ApplicationCommands.Paste" Content="{Picture Paste}" ToolTip="{Localizing Paste}"/>
        <Button Command="ApplicationCommands.Delete" Content="{Picture Delete}" ToolTip="{Localizing Delete}"/>
        <Separator/>
        <Button Command="ApplicationCommands.Undo" Content="{Picture Undo}" ToolTip="{Localizing Undo}"/>
        <Button Command="ApplicationCommands.Redo" Content="{Picture Redo}" ToolTip="{Localizing Redo}"/>
    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="MainToolBarCollection">

        <ToolBar 
            Tag="StandartToolBar"
            LocalizingManager.AttachedLocalizing="{Localizing Standart}"
            Band="{ViewModel StandartToolBarBand, DefaultValue=0, ElementName=This}"
            BandIndex="{ViewModel StandartToolBarBandIndex, DefaultValue=0, ElementName=This}"
            ItemsSource="{StaticResource ShellStandartToolBarItems}"
            Visibility="{ViewModel ShowStandartToolBar, ElementName=This, DefaultValue=True}"
            PreviewGotKeyboardFocus="IgnoreGotKeyboardFocus">
        </ToolBar>

        <ToolBar
            Tag="TextEditorToolBar"
            LocalizingManager.AttachedLocalizing="{Localizing TextEditor}"
            Band="{ViewModel TextEditorToolBarBand, DefaultValue=0, ElementName=This}"
            BandIndex="{ViewModel TextEditorToolBarBandIndex, DefaultValue=1, ElementName=This}"
            Visibility="{ViewModel ShowTextEditorToolBar, ElementName=This, DefaultValue=True}"
            DataContext="{Binding ActiveDocumentView.DataContext.TextEditorViewModel}" 
            ItemsSource="{StaticResource TextEditorOptionsToolBarCollection}"
            PreviewGotKeyboardFocus="IgnoreGotKeyboardFocus"/>

        <ToolBar
            Tag="ExtensionToolBar"
            LocalizingManager.AttachedLocalizing="{Localizing Extension}"
            Band="{ViewModel ExtensionsToolBarBand, DefaultValue=0, ElementName=This}"
            BandIndex="{ViewModel ExtensionsToolBarBandIndex, DefaultValue=2, ElementName=This}"
            Visibility="{ViewModel ShowExtensionsToolBar, ElementName=This, DefaultValue=True}"
            DataContext="{Binding ActiveDocumentView.DataContext}" 
            ItemsSource="{StaticResource ExtensionsToolBarCollection}"/>

    </XamlCollection>

    <XamlCollection  x:Shared="False" x:Key="DocumentStandartToolBarItems">
        <Button Command="ApplicationCommands.Open" CommandParameter=":Reload" Content="{Picture Reload}" ToolTip="{Localizing NewToolTip}"/>
        <Button Command="ApplicationCommands.Save" Content="{Picture Save}" ToolTip="{Localizing NewToolTip}"/>
        <Separator/>
        <Button Command="ApplicationCommands.Cut" Content="{Picture Cut}" ToolTip="{Localizing NewToolTip}"/>
        <Button Command="ApplicationCommands.Copy" Content="{Picture Copy}" ToolTip="{Localizing NewToolTip}"/>
        <Button Command="ApplicationCommands.Paste" Content="{Picture Paste}" ToolTip="{Localizing NewToolTip}"/>
        <Button Command="ApplicationCommands.Delete" Content="{Picture Delete}" ToolTip="{Localizing NewToolTip}"/>
        <Separator/>
        <Button Command="ApplicationCommands.Undo" Content="{Picture Undo}" ToolTip="{Localizing UndoToolTip}"/>
        <Button Command="ApplicationCommands.Redo" Content="{Picture Redo}" ToolTip="{Localizing RedoToolTip}"/>
    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="DocumentToolBarCollection">

        <ToolBar 
            Tag="StandartToolBar"
            ItemsSource="{StaticResource DocumentStandartToolBarItems}"
            Visibility="{ViewModel ShowStandartToolBar, ElementName=This, DefaultValue=True}"/>

        <ToolBar
            Tag="TextEditorToolBar" 
            DataContext="{Binding TextEditorViewModel}"
            ItemsSource="{StaticResource TextEditorOptionsToolBarCollection}"
            Visibility="{ViewModel ShowTextEditorToolBar, ElementName=This, DefaultValue=True}"/>

        <ToolBar
            Tag="ExtensionsToolBar" 
            ItemsSource="{StaticResource ExtensionsToolBarCollection}"
            Visibility="{ViewModel ShowExtensionsToolBar, ElementName=This, DefaultValue=True}"/>

    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="FontToolBarCollection">

        <Expander Header="{Localizing TextEditor}" IsExpanded="{ViewModel IsTextEditorExpanded, DefaultValue=True}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>

                <TextBlock Grid.Row="0" Grid.Column="0" Text="{Localizing Size, StringFormat='\{0}:'}"/>
                <ComboBox
				Grid.Row="0" Grid.Column="1"
				IsEditable="True" IsTextSearchEnabled="False"
				SelectedItem="{Binding FontSize, Converter={StaticResource ControlFontSizeConverter}}"
				ItemsSource="{Binding Source={StaticResource DefaultFontSizes}}"
				Text="{Binding FontSize, Converter={StaticResource ControlFontSizeConverter}}"/>

                <TextBlock Grid.Row="1" Grid.Column="0" Text="{Localizing Family, StringFormat='\{0}:'}"/>
                <ComboBox
					Grid.Row="1" Grid.Column="1"
					IsEditable="True"
					SelectedItem="{Binding FontFamily}"
					ItemsSource="{x:Static Fonts.SystemFontFamilies}">
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding}" FontFamily="{Binding}" Foreground="Black"/>
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                </ComboBox>

                <TextBlock Grid.Row="3" Grid.Column="0" Text="{Localizing Style, StringFormat='\{0}:'}"/>
                <ComboBox
					Grid.Row="3" Grid.Column="1"
					IsEditable="True"
					SelectedItem="{Binding FontStyle}"
					ItemsSource="{Binding Source={StaticResource DefaultFontStyles}}"
					Text="{Binding FontStyle, Converter={StaticResource ToStringConverter}}"/>

                <TextBlock Grid.Row="4" Grid.Column="0" Text="{Localizing Weight, StringFormat='\{0}:'}"/>
                <ComboBox
				    Grid.Row="4" Grid.Column="1"
				    IsEditable="True"
				    SelectedItem="{Binding FontWeight}"
				    ItemsSource="{Binding Source={StaticResource DefaultFontWeights}}"
				    Text="{Binding FontWeight, Converter={StaticResource ToStringConverter}}"/>

                <TextBlock Grid.Row="5" Grid.Column="0" Text="{Localizing Stretch, StringFormat='\{0}:'}"/>
                <ComboBox
				    Grid.Row="5" Grid.Column="1"
				    IsEditable="True"
				    SelectedItem="{Binding FontStretch}"
				    ItemsSource="{Binding Source={StaticResource DefaultFontStretches}}"/>

                <Separator Grid.Row="6" Grid.ColumnSpan="2"/>

            </Grid>
        </Expander>
    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="PaletteToolBarCollection">

        <Expander Header="{Localizing TextEditor}"  IsExpanded="{ViewModel IsTextEditorExpanded, DefaultValue=True}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>

                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>

                <TextBlock Grid.Row="0" Grid.Column="0" Text="{Localizing Text, StringFormat='\{0}:'}"/>
                <views:PaletteBoxView BrushMode="True" Grid.Row="0" Grid.Column="1" Brush="{Binding Foreground}"/>
                <TextBlock Grid.Row="1" Grid.Column="0" Text="{Localizing Background, StringFormat='\{0}:'}"/>
                <views:PaletteBoxView BrushMode="True"  Grid.Row="1" Grid.Column="1" Brush="{Binding Background}"/>
                <Separator Grid.Row="2" Grid.ColumnSpan="2"/>
            </Grid>
        </Expander>

        <Expander Header="{Localizing LineNumber}"  IsExpanded="{ViewModel IsLineNumberExpanded, DefaultValue=True}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>

                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>

                <TextBlock Grid.Row="0" Grid.Column="0" Text="{Localizing Text, StringFormat='\{0}:'}"/>
                <views:PaletteBoxView BrushMode="True" Grid.Row="0" Grid.Column="1" Brush="{Binding TextArea.LineNumberForeground}"/>
                <TextBlock Grid.Row="1" Grid.Column="0" Text="{Localizing Separator, StringFormat='\{0}:'}"/>
                <views:PaletteBoxView BrushMode="True" Grid.Row="1" Grid.Column="1" Brush="{Binding TextArea.LineNumberSeparator}"/>
                <Separator Grid.Row="3" Grid.ColumnSpan="2"/>
            </Grid>
        </Expander>

        <Expander Header="{Localizing Selection}" IsExpanded="{ViewModel IsSelectionExpanded, DefaultValue=False}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>

                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>

                <TextBlock Grid.Row="0" Grid.Column="0" Text="{Localizing Text, StringFormat='\{0}:'}"/>
                <views:PaletteBoxView BrushMode="True" Grid.Row="0" Grid.Column="1" Brush="{Binding TextArea.SelectionForeground}"/>

                <TextBlock Grid.Row="1" Grid.Column="0" Text="{Localizing Background, StringFormat='\{0}:'}"/>
                <views:PaletteBoxView BrushMode="True" Grid.Row="1" Grid.Column="1" Brush="{Binding TextArea.SelectionBrush}"/>

                <TextBlock Grid.Row="2" Grid.Column="0" Text="{Localizing Border, StringFormat='\{0}:'}"/>
                <views:PaletteBoxView 
                    Grid.Row="2" Grid.Column="1" 
                    Pen="{Binding TextArea.SelectionBorder}"
                    CornerRadius="{Binding TextArea.SelectionCornerRadius}"/>

                <Separator Grid.Row="3" Grid.ColumnSpan="2"/>
            </Grid>
        </Expander>

        <Expander Header="{Localizing Accentuate}" IsExpanded="{ViewModel IsAccentuateExpanded, DefaultValue=False}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>

                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>

                <TextBlock Grid.Row="1" Grid.Column="0" Text="{Localizing Background, StringFormat='\{0}:'}"/>
                <views:PaletteBoxView BrushMode="True" Grid.Row="1" Grid.Column="1" Brush="{Binding TextArea.AccentuateBrush}"/>

                <TextBlock Grid.Row="2" Grid.Column="0" Text="{Localizing Border, StringFormat='\{0}:'}"/>
                <views:PaletteBoxView 
                    Grid.Row="2" Grid.Column="1" 
                    Pen="{Binding TextArea.AccentuateBorder}"
                    CornerRadius="{Binding TextArea.AccentuateCornerRadius}"/>

                <Separator Grid.Row="3" Grid.ColumnSpan="2"/>
            </Grid>
        </Expander>

        <Expander Header="{Localizing CurrentLine}" IsExpanded="{ViewModel IsCurrentLineExpanded, DefaultValue=False}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>

                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>

                <!--<TextBlock Grid.Row="0" Grid.Column="0" Text="{Localizing Text, StringFormat='\{0}:'}"/>
				<ComboBox 
					Grid.Row="0" Grid.Column="1" MinWidth="16"
                    IsEditable="True" Margin="3" SelectedValuePath="Fill"
                    ItemsSource="{Binding Source={StaticResource DefaultPalette}}"
                    ItemTemplate="{StaticResource BrushComboBoxItemTemplate}"
                    Text="{Binding TextArea.CurrentLineForeground, TargetNullValue='', FallbackValue={x:Null}}"/>-->

                <TextBlock Grid.Row="1" Grid.Column="0" Text="{Localizing Background, StringFormat='\{0}:'}"/>
                <views:PaletteBoxView BrushMode="True" Grid.Row="1" Grid.Column="1" Brush="{Binding TextArea.CurrentLineBrush}"/>

                <TextBlock Grid.Row="2" Grid.Column="0" Text="{Localizing Border, StringFormat='\{0}:'}"/>
                <views:PaletteBoxView 
                    Grid.Row="2" Grid.Column="1" 
                    Pen="{Binding TextArea.CurrentLineBorder}"
                    CornerRadius="{Binding TextArea.CurrentLineCornerRadius}"/>

                <Separator Grid.Row="3" Grid.ColumnSpan="2"/>
            </Grid>
        </Expander>

    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="SettingsCommands">
        <Separator Margin="1 0 1 4"/>
        <Expander
            Header="{Localizing Action}" 
            IsExpanded="{Binding IsOpen, Mode=TwoWay, ElementName=ContextMenu}" PreviewMouseDown="UIElement_OnMouseDown">
            <Expander.ContextMenu>
                <ContextMenu Name="ContextMenu">
                    <MenuItem Header="{Localizing SetAsDefault}" Command="{Binding SetAsDefault}"/>
                    <MenuItem Header="{Localizing DefaultSettings}" Command="{Binding SetDefault}"/>
                    <MenuItem Header="{Localizing FactorySettings}" Command="{Binding SetFactory}"/>
                    <MenuItem Header="{Localizing ApplyToAll}" Command="{Binding ApplyToAll}"/>
                </ContextMenu>
            </Expander.ContextMenu>

        </Expander>
    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="DocumentStatus">

        <TextBlock 
            Tag="EncodingBodyName" Background="DarkGray"
            LocalizingManager.AttachedLocalizing="{Localizing Encoding, Tail={Localizing BodyName, StringFormat='{} ({0})', Transformer={x:Static LocalizingManager.DefaultWithToLower}}}"
            Visibility="{ViewModel RelativeSource={RelativeSource AncestorLevel=1, AncestorType=Control}, DefaultValue=False}"
            Text="{Binding ActiveTextEditorView.Encoding.BodyName}"/>

        <TextBlock 
            Tag="EncodingDisplayName"      
            LocalizingManager.AttachedLocalizing="{Localizing Encoding, Tail={Localizing DisplayName, StringFormat='{} ({0})', Transformer={x:Static LocalizingManager.DefaultWithToLower}}}"
            Visibility="{ViewModel RelativeSource={RelativeSource AncestorLevel=1, AncestorType=Control}, DefaultValue=True}"
            Text="{Binding ActiveTextEditorView.Encoding.EncodingName}"/>

        <TextBlock
            Tag="Title"    
            Visibility="{ViewModel RelativeSource={RelativeSource AncestorLevel=1, AncestorType=Control}}"
            Text="{Binding Title, FallbackValue={Localizing None}}"
            ToolTip="{Binding FileName, FallbackValue={Localizing None}}"/>

        <TextBlock 
            Tag="FileName"   
            Visibility="{ViewModel RelativeSource={RelativeSource AncestorLevel=1, AncestorType=Control}, DefaultValue=False}"
            Text="{Binding FileName, FallbackValue={Localizing NoFile}, TargetNullValue={Localizing NotSaved, StringFormat='[{0}]'}}" 
            ToolTip="{Binding Title, FallbackValue={Localizing NoFile}}"/>

        <TextBlock
            Tag="LineCount" 
            Visibility="{ViewModel RelativeSource={RelativeSource AncestorLevel=1, AncestorType=Control}, DefaultValue=False}"
            Text="{LocalizedBinding Lines, Binding={Binding ActiveTextEditorView.Document.LineCount, StringFormat='{}{L} {0}'}}"/>

        <TextBlock 
            Tag="TextLength" 
            Visibility="{ViewModel RelativeSource={RelativeSource AncestorLevel=1, AncestorType=Control}, DefaultValue=False}"
            Text="{LocalizedBinding Size, Binding={Binding ActiveTextEditorView.Document.TextLength, StringFormat='{}{L} {0}'}}"/>

    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="CaretStatus">

        <TextBlock
            Tag="LineNumber" 
            Visibility="{ViewModel RelativeSource={RelativeSource AncestorLevel=1, AncestorType=Control}, DefaultValue=True}"
            Text="{LocalizedBinding Ln, Binding={Binding ActiveTextEditorView.TextArea.Caret.Line, StringFormat='{}{L} {0}'}}"/>

        <TextBlock 
            Tag="ColumnNumber"
            Visibility="{ViewModel RelativeSource={RelativeSource AncestorLevel=1, AncestorType=Control}, DefaultValue=True}"
            Text="{LocalizedBinding Col, Binding={Binding ActiveTextEditorView.TextArea.Caret.Column, StringFormat='{}{L} {0}'}}"/>

        <TextBlock 
            Tag="Offset"
            Visibility="{ViewModel RelativeSource={RelativeSource AncestorLevel=1, AncestorType=Control}, DefaultValue=True}"
            Text="{LocalizedBinding Off, Binding={Binding ActiveTextEditorView.TextArea.Caret.Offset, StringFormat='{}{L} {0}'}}"/>

    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="SelectionStatus">

        <TextBlock 
            Tag="Start" 
            Name="SelectionStart"
            Visibility="{ViewModel RelativeSource={RelativeSource AncestorLevel=1, AncestorType=Control}, DefaultValue=False}"
            Text="{LocalizedBinding Sta, Binding={Binding ActiveTextEditorView.SelectionStart, StringFormat='{}{L} {0}'}}"/>

        <TextBlock
            Tag="End"
            Name="SelectionEnd"
            Visibility="{ViewModel RelativeSource={RelativeSource AncestorLevel=1, AncestorType=Control}, DefaultValue=False}"
            Text="{LocalizedBinding End_, Binding={Binding ActiveTextEditorView.SelectionEnd, StringFormat='{}{L} {0}'}}"/>

        <TextBlock  
            Tag="Lenght"
            Name="SelectionLenght"
            Visibility="{ViewModel RelativeSource={RelativeSource AncestorLevel=1, AncestorType=Control}, DefaultValue=True}"
            Text="{LocalizedBinding Len, Binding={Binding ActiveTextEditorView.SelectionLength, StringFormat='{}{L} {0}'}}"/>

    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="StatusBarMenuItems">

        <MenuItem 
            Header="{Localizing Document}"
            Style="{StaticResource CheckableStyle}"
            IsChecked="{ViewModel ShowDocumentStatusBarItems}"
            ItemsSource="{VisibilityMenuItems SourceName=DocumentStatus, SourcePropertyName=ItemsSource, StyleStaticKey=CheckableItemStyle}"/>

        <MenuItem 
            Header="{Localizing Caret}" 
            Style="{StaticResource CheckableStyle}"
            IsChecked="{ViewModel ShowCaretStatusBarItems}"
            ItemsSource="{VisibilityMenuItems SourceName=CaretStatus, SourcePropertyName=ItemsSource, StyleStaticKey=CheckableItemStyle}"/>

        <MenuItem 
            Header="{Localizing Selection}"          
            Style="{StaticResource CheckableStyle}"
            IsChecked="{ViewModel ShowSelectionStatusBarItems}"
            ItemsSource="{VisibilityMenuItems SourceName=SelectionStatus, SourcePropertyName=ItemsSource, StyleStaticKey=CheckableItemStyle}"/>

        <Separator/>

        <MenuItem 
            Header="{Localizing Separator, StringFormat='{}{0} 1'}" 
            Style="{StaticResource CheckableStyle}"
            IsChecked="{ViewModel ShowSeparator0}"/>

        <MenuItem 
            Header="{Localizing Separator, StringFormat='{}{0} 2'}"
            Style="{StaticResource CheckableStyle}"
            IsChecked="{ViewModel ShowSeparator1}"/>

        <Separator/>

        <MenuItem 
            Header="{Localizing ToolTip}"
            Style="{StaticResource CheckableStyle}"
            IsChecked="{ViewModel ShowStatusBarToolTip, DefaultValue=True}"/>

    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="StatusBarItems">
        <StatusBarItem Grid.Column="0" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch">

            <StatusBarItem.ContextMenu>
                <ContextMenu ItemsSource="{StaticResource StatusBarMenuItems}"/>
            </StatusBarItem.ContextMenu>

            <ItemsControl HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch">

                <Grid  HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="{Binding [DocumentStatusWidth], Mode=TwoWay, FallbackValue='1*', TargetNullValue='1*', Converter={DefaultConverter '1*'}}"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="{Binding [DocumentStatusWidth1], Mode=TwoWay, FallbackValue='1*', TargetNullValue='1*', Converter={DefaultConverter '1*'}}"/>
                    </Grid.ColumnDefinitions>

                    <!--<ItemsControl 
                            Grid.Column="0" 
                            Name="DocumentStatus" 
                            ItemsSource="{StaticResource ShellStandartToolBarItems}"
                            Visibility="{ViewModel ShowCaretStatusBarItems, Converter={StaticResource BooleanToVisibilityConverter}}">
                        <ItemsControl.Resources>
                            <Style TargetType="{x:Type ButtonBase}" x:Key="{x:Static ToolBar.ButtonStyleKey}"></Style>
                        </ItemsControl.Resources>
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel Style="{StaticResource Container}"/>
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                    </ItemsControl>-->

                    <ItemsControl 
                        Grid.Column="0"
                        Name="DocumentStatus" 
                        ItemsSource="{StaticResource DocumentStatus}" 
                        Visibility="{ViewModel ShowDocumentStatusBarItems, DefaultValue=True}">
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel Style="{StaticResource Container}"/>
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                    </ItemsControl>

                    <Separator 
                        Grid.Column="1"
                        HorizontalAlignment="Center"
                        Visibility="{ViewModel ShowSeparator0, DefaultValue=True}">
                        <Separator.LayoutTransform>
                            <RotateTransform Angle="90" />
                        </Separator.LayoutTransform>
                    </Separator>
                    <GridSplitter Grid.Column="1" Width="8" Focusable="False" ResizeDirection="Columns" VerticalAlignment="Stretch" HorizontalAlignment="Center" Background="Transparent"/>

                    <Grid Grid.Column="2">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="{Binding [CaretStatusWidth], Mode=TwoWay, FallbackValue='1*', TargetNullValue='1*', Converter={DefaultConverter '1*'}}"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="{Binding [CaretStatusWidth1], Mode=TwoWay, FallbackValue='1*', TargetNullValue='1*', Converter={DefaultConverter '1*'}}"/>
                        </Grid.ColumnDefinitions>

                        <ItemsControl 
                            Grid.Column="0" 
                            Name="CaretStatus" 
                            ItemsSource="{StaticResource CaretStatus}"
                            Visibility="{ViewModel ShowCaretStatusBarItems, DefaultValue=True}">
                            <ItemsControl.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <StackPanel Style="{StaticResource Container}"/>
                                </ItemsPanelTemplate>
                            </ItemsControl.ItemsPanel>
                        </ItemsControl>

                        <Separator Grid.Column="1" HorizontalAlignment="Center" Visibility="{ViewModel ShowSeparator1, DefaultValue=True}">
                            <Separator.LayoutTransform>
                                <RotateTransform Angle="90" />
                            </Separator.LayoutTransform>
                        </Separator>
                        <GridSplitter Grid.Column="1" Width="8" Focusable="False" ResizeDirection="Columns" VerticalAlignment="Stretch" HorizontalAlignment="Center" Background="Transparent"/>

                        <ItemsControl
                            Grid.Column="2"
                            Name="SelectionStatus" 
                            ItemsSource="{StaticResource SelectionStatus}"
                            Visibility="{ViewModel ShowSelectionStatusBarItems, DefaultValue=True}">
                            <ItemsControl.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <StackPanel Style="{StaticResource Container}"/>
                                </ItemsPanelTemplate>
                            </ItemsControl.ItemsPanel>
                        </ItemsControl>

                    </Grid>

                </Grid>

            </ItemsControl>
        </StatusBarItem>
    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="ViewModeMenuItems">
        <MenuItem Header="Rich" Command="{Binding SetViewModeCommand}" CommandParameter="Rich"/>
        <MenuItem Header="Standart" Command="{Binding SetViewModeCommand}" CommandParameter="Standart"/>
        <MenuItem Header="Light" Command="{Binding SetViewModeCommand}" CommandParameter="Light"/>
        <MenuItem Header="Compact" Command="{Binding SetViewModeCommand}" CommandParameter="Compact"/>
    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="DocumentViewMenuItems">
        <MenuItem Header="{Localizing ViewMode}" ItemsSource="{StaticResource ViewModeMenuItems}"/>
        <Separator/>
        <MenuItem Header="{Localizing Menu}" IsCheckable="True" IsChecked="{ViewModel ShowMenu}"/>
        <MenuItem 
            Header="{Localizing ToolBarTray}" 
            Style="{StaticResource CheckableStyle}"
            IsChecked="{ViewModel ShowToolBarTray}" 
            ItemsSource="{VisibilityMenuItems SourceName=ToolBarTray, SourcePropertyName=ToolBars, StyleStaticKey=CheckableItemStyle}"/>
        <MenuItem 
            Header="{Localizing StatusBar}" 
            Style="{StaticResource CheckableStyle}"
            IsChecked="{ViewModel ShowStatusBar}" 
            ItemsSource="{StaticResource StatusBarMenuItems}"/>
    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="DocumentFileMenuItems">
        <MenuItem Header="{Localizing Reload}" Command="ApplicationCommands.Open" CommandParameter=":Reload" Icon="{Picture Reload}" InputGestureText="Ctrl+R"/>
        <Separator/>
        <MenuItem Header="{Localizing Save}" Command="ApplicationCommands.Save" Icon="{Picture Save}"/>
        <MenuItem Header="{Localizing SaveAs}" Command="ApplicationCommands.SaveAs"/>
        <Separator/>
        <MenuItem Header="{Localizing Print}" ItemsSource="{StaticResource PrintMenuItems}"/>
        <Separator/>
        <MenuItem Header="{Localizing Close}" Command="ApplicationCommands.Close" Icon="{Picture Close}"/>
    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="ViewMenuItems">
        <MenuItem Header="{Localizing Topmost}" IsCheckable="True" IsChecked="{ViewModel Topmost}"/>
        <MenuItem Header="{Localizing ViewMode}" ItemsSource="{StaticResource ViewModeMenuItems}"/>
        <Separator/>
        <MenuItem 
            Header="{Localizing ToolBarTray}" 
            Style="{StaticResource CheckableStyle}"
            IsChecked="{ViewModel ShowToolBarTray}" 
            ItemsSource="{VisibilityMenuItems SourceName=ToolBarTray, SourcePropertyName=ToolBars, StyleStaticKey=CheckableItemStyle}"/>
        <MenuItem 
            Header="{Localizing StatusBar}" 
            Style="{StaticResource CheckableStyle}"
            IsChecked="{ViewModel ShowStatusBar}"
            ItemsSource="{StaticResource StatusBarMenuItems}"/>
        <Separator/>
        <MenuItem Header="{Localizing ShowInTaskbar}" IsCheckable="True" IsChecked="{Binding ShowInTaskbar}"/>
        <MenuItem Header="{Localizing ShowInTray}" IsCheckable="True" IsChecked="{Binding ShowInTray}"/>
        <Separator/>
        <MenuItem Header="{Localizing Window}" Icon="{Picture AppWindow}">
            <MenuItem Header="{Localizing Style}" Name="WindowStyleMenu" ItemsSource="{EnumRadioMenu SourceName=This, SourcePropertyName=WindowStyle}"/>
            <MenuItem Header="{Localizing Size}" Name="ResizeModeMenu" ItemsSource="{EnumRadioMenu SourceName=This, SourcePropertyName=ResizeMode}"/>
        </MenuItem>
        <MenuItem Header="{Localizing Theme}" Icon="{Picture Theme}">
            <MenuItem Header="Default" Click="SetDefaultTheme"/>
            <Separator/>
            <MenuItem Header="Aero" Tag="aero.normalcolor">
                <MenuItem Header="Custom" Click="MenuItemClick" Tag="ChangeAeroThemeColor"/>
                <Separator/>
                <MenuItem Header="Pink" Click="ChangeColor"/>
                <MenuItem Header="Red" Click="ChangeColor"/>
                <MenuItem Header="Orange" Click="ChangeColor"/>
                <MenuItem Header="Green" Click="ChangeColor"/>
                <MenuItem Header="Blue" Click="ChangeColor"/>
                <MenuItem Header="Gray" Click="ChangeColor"/>
            </MenuItem>

            <MenuItem Header="Classic" Tag="classic" Click="ChangeTheme"/>
            <MenuItem Header="Luna.Normalcolor" Tag="luna.normalcolor" Click="ChangeTheme"/>
            <MenuItem Header="Generic" Tag="generic" Click="ChangeTheme"/>
            <Separator/>
            <MenuItem Header="Dev 2010" Tag="/AvalonDock.Themes;component/themes/dev2010.xaml" Click="ChangeTheme"/>
            <MenuItem Header="Expression Dark" Tag="/AvalonDock.Themes;component/themes/ExpressionDark.xaml" Click="ChangeTheme"/>
        </MenuItem>
        <Separator/>
        <MenuItem Header="{Localizing DesktopShortcut}" IsCheckable="True" IsChecked="{Binding SettingsViewModel.DesktopLink}" StaysOpenOnClick="True" Style="{StaticResource AutoUpdateBindingsStyle}"/>
        <!--<MenuItem Header="{Localizing DisableWindowActivation}" IsCheckable="True" IsChecked="{Binding DisableWindowActivation}"/>-->
    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="FileMenuItems">
        <MenuItem Header="{Localizing New}" Command="ApplicationCommands.New" Icon="{Picture New}"/>
        <MenuItem Header="{Localizing Open}" Command="ApplicationCommands.Open" Icon="{Picture Open}"/>
        <Separator/>
        <MenuItem Header="{Localizing Save}" Command="ApplicationCommands.Save" Icon="{Picture Save}"/>
        <MenuItem Header="{Localizing SaveAs}" Command="ApplicationCommands.SaveAs"/>
        <MenuItem Header="{Localizing SaveAll}" Command="Save" CommandParameter="All" ToolTip="Ctrl+Shift+S" InputGestureText=" " Icon="{Picture SaveAll}"/>
        <Separator/>
        <MenuItem Header="{Localizing Close}" Command="ApplicationCommands.Close" InputGestureText="Alt+X"/>
        <MenuItem Header="{Localizing CloseAll}" Command="ApplicationCommands.Close" CommandParameter="All" ToolTip="Alt+Shift+X"/>
        <Separator/>
        <MenuItem Header="{Localizing Print}" ItemsSource="{StaticResource PrintMenuItems}"/>
        <Separator/>
        <MenuItem Header="{Localizing Exit}" Command="ApplicationCommands.Close" CommandParameter="App" InputGestureText="Alt+F4" Icon="{Picture Exit}"/>
    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="ContentMenuItems">
        <MenuItem ItemsSource="{Binding RecentFileManagerViewModel.RecentFiles}" Icon="{Picture blue-documents-text}">
            <MenuItem.HeaderTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal" Name="RecentPanel" DataContext="{Binding}">
                        <StackPanel.ContextMenu>
                            <ContextMenu Name="ContextMenu">
                                <MenuItem Header="{Localizing Remove, Tail={Localizing Unpinned, StringFormat='{} ({0})', Transformer={x:Static LocalizingManager.DefaultWithToLower}}}" Command="CorrectionList" CommandParameter="ClearUnpinned" Loaded="Clear_OnLoaded"/>
                                <MenuItem Header="{Localizing Remove, Tail={Localizing Pinned, StringFormat='{} ({0})', Transformer={x:Static LocalizingManager.DefaultWithToLower}}}" Command="CorrectionList" CommandParameter="ClearPinned" Loaded="Clear_OnLoaded"/>
                                <Separator/>
                                <MenuItem Header="{Localizing Clear}" Command="CorrectionList" CommandParameter="Clear" Loaded="Clear_OnLoaded"/>
                            </ContextMenu>
                        </StackPanel.ContextMenu>
                        <Expander
                            PreviewMouseLeftButtonUp="ToggleButton_OnClick"
                            Margin="0 -2 0 -3" 
                            IsExpanded="{Binding IsOpen, Mode=TwoWay, ElementName=ContextMenu}"/>
                        <TextBlock Text="{Localizing RecentFiles}"/>
                    </StackPanel>
                </DataTemplate>
            </MenuItem.HeaderTemplate>
            <MenuItem.ItemContainerStyle>
                <Style TargetType="{x:Type MenuItem}">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate>
                                <Grid>
                                    <MenuItem 
                                        Header="{Binding Path}"
                                        IsCheckable="True"
                                        IsChecked="{Binding IsOpened, Mode=TwoWay}"
                                        IsEnabled="{Binding IsActiveDocument, Mode=OneWay, Converter={StaticResource BooleanInvertConverter}}"
                                        Click="OnCheckDocumentView"/>
                                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="1">
                                        <StackPanel.Resources>
                                            <BooleanConverter x:Key="PinConverter" OnFalse="{Picture Pin, 13}" OnTrue="{Picture Unpin, 13}"/>
                                            <BooleanConverter x:Key="PinTooltipConverter" OnFalse="{Localizing Pin}" OnTrue="{Localizing Unpin}"/>
                                        </StackPanel.Resources>
                                        <ToggleButton
                                            RenderOptions.BitmapScalingMode="NearestNeighbor"
                                            Margin="1"
                                            Focusable="False"
                                            HorizontalAlignment="Right"
                                            IsChecked="{Binding IsPinned}"  
                                            Content="{Binding IsPinned, Converter={StaticResource PinConverter}}" 
                                            ToolTip="{Binding IsPinned, Converter={StaticResource PinTooltipConverter}}"/>
                                        <Button 
                                            RenderOptions.BitmapScalingMode="NearestNeighbor"
                                            Margin="1"
                                            Focusable="False" 
                                            Content="{Picture PinClose, 13}"
                                            ToolTip="{Localizing Remove}"
                                            Command="CorrectionList" 
                                            CommandParameter="{Binding}"/>
                                    </StackPanel>
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </MenuItem.ItemContainerStyle>
        </MenuItem>
        <Separator/>
        <MenuItem Header="{Localizing Document}" Name="DocumentViewsMenuItem" ItemsSource="{Binding DocumentViews}" Icon="{Picture blue-document-epub-text}">
            <MenuItem.ItemContainerStyle>
                <Style TargetType="{x:Type MenuItem}">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate>
                                <Grid>
                                    <MenuItem 
                                        Header="{Binding DataContext.Title}" 
                                        ToolTip="{Binding DataContext.FileName}" 
                                        IsChecked="{Binding IsActiveDocument, Mode=OneWay}"
                                        IsEnabled="{Binding IsActiveDocument, Mode=OneWay, Converter={StaticResource BooleanInvertConverter}}"
                                        Click="OnCheckDocumentView"/>
                                    <StackPanel HorizontalAlignment="Right" Margin="1">
                                        <Button 
                                            RenderOptions.BitmapScalingMode="NearestNeighbor"
                                            Margin="1"
                                            Focusable="False"
                                            Content="{Picture PinClose, 13}"
                                            ToolTip="{Localizing Close}"
                                            Command="Close" 
                                            CommandTarget="{Binding}"/>
                                    </StackPanel>
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </MenuItem.ItemContainerStyle>
        </MenuItem>
        <MenuItem Header="{Localizing Tool}" ItemsSource="{StaticResource Tools}" Icon="{Picture toolbox}">
            <MenuItem.ItemContainerStyle>
                <Style TargetType="{x:Type MenuItem}">
                    <Setter Property="Header" Value="{Binding Title}" />
                    <EventSetter Event="Click" Handler="OnCheckDocumentView"/>
                    <Setter Property="StaysOpenOnClick" Value="True"/>
                    <Setter Property="IsEnabled" Value="{Binding IsActiveContent, Mode=OneWay, Converter={StaticResource BooleanInvertConverter}}"/>
                    <Setter Property="Icon" Value="{Binding Icon, Converter={StaticResource ImageSourceToImageConverter}, ConverterParameter=16}"/>
                </Style>
            </MenuItem.ItemContainerStyle>
        </MenuItem>
        <MenuItem Header="{Localizing Plugin}" ItemsSource="{StaticResource Plugins}" Icon="{Picture plug}" >
            <MenuItem.ItemContainerStyle>
                <Style TargetType="{x:Type MenuItem}">
                    <Setter Property="Header" Value="{Binding Title}" />
                    <EventSetter Event="Click" Handler="OnCheckDocumentView1"/>
                    <Setter Property="StaysOpenOnClick" Value="False"/>
                    <Setter Property="IsEnabled" Value="{Binding IsActiveContent, Mode=OneWay, Converter={StaticResource BooleanInvertConverter}}"/>
                    <Setter Property="Icon" Value="{Binding Icon, Converter={StaticResource ImageSourceToImageConverter}, ConverterParameter=16}"/>
                </Style>
            </MenuItem.ItemContainerStyle>
        </MenuItem>
        <MenuItem Header="{Localizing Settings}" Icon="{Picture wrench-screwdriver}">
            <MenuItem Header="{Localizing Autorun}">
                <MenuItem Header="{Localizing Shortcut, Tail={Localizing ForMe, StringFormat='{} ({0})', Transformer={x:Static LocalizingManager.DefaultWithToLower}}}" DataContext="{Binding SettingsViewModel}" IsCheckable="True" IsChecked="{Binding AutorunShortcut}" Style="{StaticResource AutoUpdateBindingsStyle}"/>
                <MenuItem Header="{Localizing RegistryValue, Tail={Localizing ForMe, StringFormat='{} ({0})', Transformer={x:Static LocalizingManager.DefaultWithToLower}}}" DataContext="{Binding SettingsViewModel}" IsCheckable="True" IsChecked="{Binding AutorunRegistryKey}" Style="{StaticResource AutoUpdateBindingsStyle}"/>
                <MenuItem Header="{Localizing Shortcut, Tail={Localizing ForAll, StringFormat='{} ({0})', Transformer={x:Static LocalizingManager.DefaultWithToLower}}}" DataContext="{Binding SettingsViewModel}" IsCheckable="True" IsChecked="{Binding AutorunShortcutCommon}" Style="{StaticResource AutoUpdateBindingsStyle}"/>
                <MenuItem Header="{Localizing RegistryValue, Tail={Localizing ForAll, StringFormat='{} ({0})', Transformer={x:Static LocalizingManager.DefaultWithToLower}}}" DataContext="{Binding SettingsViewModel}" IsCheckable="True" IsChecked="{Binding AutorunRegistryKeyCommon}" Style="{StaticResource AutoUpdateBindingsStyle}"/>
            </MenuItem>
            <MenuItem Header="{Localizing Desktop}">
                <MenuItem Header="{Localizing Shortcut, Tail={Localizing ForMe, StringFormat='{} ({0})', Transformer={x:Static LocalizingManager.DefaultWithToLower}}}" DataContext="{Binding SettingsViewModel}" IsCheckable="True" IsChecked="{Binding DesktopDirectoryLink}" Style="{StaticResource AutoUpdateBindingsStyle}"/>
                <MenuItem Header="{Localizing Shortcut, Tail={Localizing ForAll, StringFormat='{} ({0})', Transformer={x:Static LocalizingManager.DefaultWithToLower}}}" DataContext="{Binding SettingsViewModel}" IsCheckable="True" IsChecked="{Binding CommonDesktopDirectoryLink}" Style="{StaticResource AutoUpdateBindingsStyle}"/>
            </MenuItem>
            <Separator/>
            <MenuItem Header="{Localizing Association}" Command="ApplicationCommands.Properties" CommandParameter="SetAssociations" InputGestureText="F5"/>
            <MenuItem Header="{Localizing Teaching}">
                <MenuItem Header="{Localizing SpellCheck}" DataContext="{Binding SettingsViewModel}" IsCheckable="True" IsChecked="{Binding SpellCheckTeaching}"/>
                <MenuItem Header="{Localizing WordComplete}" DataContext="{Binding SettingsViewModel}" IsCheckable="True" IsChecked="{Binding WordCompleteTeaching}"/>
            </MenuItem>
            <MenuItem Header="{Localizing Language}">
                <MenuItem Header="{Localizing English}" Tag="En" Click="MenuItemClick"/>
                <MenuItem Header="{Localizing Russian}" Tag="Ru" Click="MenuItemClick"/>
            </MenuItem>
        </MenuItem>
        <Separator/>
        <MenuItem Header="{Localizing Navigator}" InputGestureText="Clrt+Tab" Click="MenuItemClick" Tag="ShowNavigatorWindow" Icon="{Picture Compass}"/>
    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="EditMenuItems">
        <MenuItem Header="{Localizing Undo}" Command="ApplicationCommands.Undo" Icon="{Picture Undo}"/>
        <MenuItem Header="{Localizing Redo}" Command="ApplicationCommands.Redo" Icon="{Picture Redo}"/>
        <Separator/>
        <MenuItem Header="{Localizing Cut}" Command="ApplicationCommands.Cut" Icon="{Picture Cut}"/>
        <MenuItem Header="{Localizing Copy}" Command="ApplicationCommands.Copy" Icon="{Picture Copy}"/>
        <MenuItem Header="{Localizing Paste}" Command="ApplicationCommands.Paste" Icon="{Picture Paste}"/>
        <MenuItem Header="{Localizing Delete}" Command="ApplicationCommands.Delete" Icon="{Picture Delete}"/>
        <Separator/>
        <MenuItem Header="{Localizing SelectAll}" Command="ApplicationCommands.SelectAll"/>
        <Separator/>
        <MenuItem Header="{Localizing Search}" Icon="{Picture Search}" ItemsSource="{StaticResource SearchMenuItems}"/>
        <MenuItem Header="{Localizing Web}" Icon="{Picture Web}" ItemsSource="{StaticResource WebMenuItems}"/>
        <MenuItem Header="{Localizing GoTo}" Command="ApplicationCommands.Find" CommandParameter="GoToLine" InputGestureText="Ctrl+G"/>
    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="FormatMenuItems">
        <MenuItem Header="{Localizing Encoding}" ItemsSource="{Binding Source={StaticResource EncodingMenuUseForSave}}"/>
        <MenuItem Header="{Localizing ReloadWith, StringFormat={}{0}...}" ItemsSource="{Binding Source={StaticResource EncodingMenuReloadWith}}"/>
        <Separator/>
        <MenuItem Header="{Localizing LineNumber}" IsCheckable="True" IsChecked="{Binding TextEditorViewModel.ShowLineNumbers}"/>
        <MenuItem Header="{Localizing CurrentLine}" IsCheckable="True" IsChecked="{Binding TextEditorViewModel.TextArea.ShowCurrentLine}"/>
        <MenuItem 
            Visibility="{Binding TextArea.ShowCurrentLine, Converter={StaticResource BooleanToVisibilityConverter}}"
            Header="{Localizing HideCurrentLineWhenTextSelected}" 
            IsCheckable="True" IsChecked="{Binding TextEditorViewModel.TextArea.HideCurrentLineWhenTextSelected}"/>
        <MenuItem Header="{Localizing TextAreaOptions}">
            <MenuItem Header="{Localizing Tab}" IsCheckable="True" IsChecked="{Binding TextEditorViewModel.Options.ShowTabs}"/>
            <MenuItem Header="{Localizing Space}" IsCheckable="True" IsChecked="{Binding TextEditorViewModel.Options.ShowSpaces}"/>
            <MenuItem Header="{Localizing EndOfLine}" IsCheckable="True" IsChecked="{Binding TextEditorViewModel.Options.ShowEndOfLine}"/>
            <MenuItem Header="{Localizing BoxForControlCharacters}" IsCheckable="True" IsChecked="{Binding TextEditorViewModel.Options.ShowBoxForControlCharacters}"/>
        </MenuItem>
        <MenuItem Header="{Localizing WordWrap}" IsCheckable="True" IsChecked="{Binding TextEditorViewModel.WordWrap}"/>
        <Separator/>
        <MenuItem Header="{Localizing TextFold}" IsCheckable="True" IsChecked="{Binding UseFolding}" Visibility="{Binding Syntax, Converter={StaticResource NullToVisibilityConverter}}"/>
        <MenuItem Header="{Localizing BracketComplete}" IsCheckable="True" IsChecked="{Binding CloseBrackets}"/>
        <MenuItem Header="{Localizing WordComplete}" IsCheckable="True" IsChecked="{Binding UseAutocomplete}"/>
        <MenuItem Header="{Localizing SpellCheck}" IsCheckable="True" IsChecked="{Binding UseSpell}"/>
        <MenuItem Header="{Localizing SyntaxHighlight}" IsCheckable="True" IsChecked="{Binding UseHighlighting}" Visibility="{Binding Syntax, Converter={StaticResource NullToVisibilityConverter}}"/>
        <!--<Separator/>
		<MenuItem Header="{Localizing Palette}" Click="ChangeBrush" Icon="{Picture Palette}"/>
		<MenuItem Header="{Localizing Font}" Click="ChangeFont" Icon="{Picture Font}"/>-->
    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="HelpMenuItems">
        <MenuItem Header="{Localizing ViewHelp}" Command="Help" Icon="{Picture Help}"/>
        <Separator/>
        <MenuItem Header="{Localizing About}" Command="ApplicationCommands.Properties" CommandParameter="About" Icon="{Picture Book}"/>
    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="MainMenuItems">
        <MenuItem Header="{Localizing File}" ItemsSource="{StaticResource FileMenuItems}"/>
        <MenuItem Header="{Localizing Edit}" ItemsSource="{StaticResource EditMenuItems}"/>
        <MenuItem Header="{Localizing Content}" ItemsSource="{StaticResource ContentMenuItems}"/>
        <MenuItem Header="{Localizing Format}" ItemsSource="{StaticResource FormatMenuItems}" DataContext="{Binding ActiveDocumentView.DataContext}"/>
        <MenuItem Header="{Localizing View}" ItemsSource="{StaticResource ViewMenuItems}"/>
        <MenuItem Header="{Localizing Help}" ItemsSource="{StaticResource HelpMenuItems}"/>
    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="DocumentMenuItems">
        <MenuItem Header="{Localizing File}" ItemsSource="{StaticResource DocumentFileMenuItems}"/>
        <MenuItem Header="{Localizing Edit}" ItemsSource="{StaticResource EditMenuItems}"/>
        <MenuItem Header="{Localizing Format}" ItemsSource="{StaticResource FormatMenuItems}"/>
        <MenuItem Header="{Localizing View}" ItemsSource="{StaticResource DocumentViewMenuItems}"/>
        <MenuItem Header="{Localizing Help}" ItemsSource="{StaticResource HelpMenuItems}"/>
    </XamlCollection>

    <XamlCollection x:Shared="False" x:Key="DocumentContextMenuItems">
        <MenuItem Header="{Localizing Spell}" ItemsSource="{Binding SpellMenuItems, Mode=OneWay}"/>
        <MenuItem Header="{Localizing Web}" Icon="{Picture Web}" ItemsSource="{StaticResource WebMenuItems}"/>
        <Separator/>
        <MenuItem Header="{Localizing Menu}" IsChecked="{ViewModel ShowMenu}" Style="{StaticResource CheckableStyle}" ItemsSource="{StaticResource DocumentMenuItems}"/>
        <Separator/>
        <MenuItem Header="{Localizing Undo}" Command="ApplicationCommands.Undo" Icon="{Picture Undo}"/>
        <MenuItem Header="{Localizing Redo}" Command="ApplicationCommands.Redo" Icon="{Picture Redo}"/>
        <Separator/>
        <MenuItem Header="{Localizing Cut}" Command="ApplicationCommands.Cut" Icon="{Picture Cut}"/>
        <MenuItem Header="{Localizing Copy}" Command="ApplicationCommands.Copy" Icon="{Picture Copy}"/>
        <MenuItem Header="{Localizing Paste}" Command="ApplicationCommands.Paste" Icon="{Picture Paste}"/>
        <MenuItem Header="{Localizing Delete}" Command="ApplicationCommands.Delete" Icon="{Picture Delete}"/>
        <Separator/>
        <MenuItem Header="{Localizing SelectAll}" Command="ApplicationCommands.SelectAll"/>
    </XamlCollection>

    <ToolTip x:Shared="False" x:Key="StatusBarToolTip">

        <ToolTip.Resources>
            <Style TargetType="GroupBox">
                <Setter Property="FontWeight" Value="Black"/>
            </Style>
            <Style TargetType="ColumnDefinition">
                <Setter Property="MinWidth" Value="96"/>
            </Style>
            <Style TargetType="TextBlock">
                <Setter Property="HorizontalAlignment" Value="Left"/>
                <Setter Property="FontWeight" Value="Normal"/>
                <Setter Property="Margin" Value="0 0 8 0"/>
            </Style>
        </ToolTip.Resources>

        <StackPanel>

            <GroupBox Header="{Localizing Document}">
                <Grid>

                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>

                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>

                    <TextBlock Grid.Column="0" Grid.Row="0" Text="{Localizing Title}"/>
                    <TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding Title, FallbackValue='{Localizing NoTitle}'}"/>

                    <TextBlock Grid.Column="0" Grid.Row="1" Text="{Localizing FileName}"/>
                    <TextBlock Grid.Column="1" Grid.Row="1" Text="{Binding FileName, FallbackValue={Localizing NoFile}, TargetNullValue={Localizing NotSaved, StringFormat='[{0}]'}}" />

                    <TextBlock Grid.Column="0" Grid.Row="2" Text="{Localizing LineCount}"/>
                    <TextBlock Grid.Column="1" Grid.Row="2" Text="{Binding ActiveTextEditorView.Document.LineCount}"/>

                    <TextBlock Grid.Column="0" Grid.Row="3" Text="{Localizing TextLength}"/>
                    <TextBlock Grid.Column="1" Grid.Row="3" Text="{Binding ActiveTextEditorView.Document.TextLength}"/>

                </Grid>
            </GroupBox>

            <GroupBox Header="{Localizing Encoding}" DataContext="{Binding TextEditorViewModel.Encoding}">
                <Grid>

                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>

                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>

                    <TextBlock Grid.Column="0" Grid.Row="0" Text="{Localizing CodePage}"/>
                    <TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding CodePage}"/>

                    <TextBlock Grid.Column="0" Grid.Row="1" Text="{Localizing BodyName}"/>
                    <TextBlock Grid.Column="1" Grid.Row="1" Text="{Binding BodyName}"/>

                    <TextBlock Grid.Column="0" Grid.Row="2" Text="{Localizing DisplayName}"/>
                    <TextBlock Grid.Column="1" Grid.Row="2" Text="{Binding EncodingName}"/>

                </Grid>
            </GroupBox>

            <GroupBox Header="{Localizing Caret}">
                <Grid>

                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>

                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>

                    <TextBlock Grid.Column="0" Grid.Row="0" Text="{Localizing Line}"/>
                    <TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding ActiveTextEditorView.TextArea.Caret.Line}"/>

                    <TextBlock Grid.Column="0" Grid.Row="1" Text="{Localizing Column}"/>
                    <TextBlock Grid.Column="1" Grid.Row="1" Text="{Binding ActiveTextEditorView.TextArea.Caret.Column}"/>

                    <TextBlock Grid.Column="0" Grid.Row="2" Text="{Localizing Offset}"/>
                    <TextBlock Grid.Column="1" Grid.Row="2" Text="{Binding ActiveTextEditorView.TextArea.Caret.Offset}" />

                </Grid>
            </GroupBox>

            <GroupBox Header="{Localizing Selection}">
                <Grid>

                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>

                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>

                    <TextBlock Grid.Column="0" Grid.Row="0" Text="{Localizing Start}"/>
                    <TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding ActiveTextEditorView.SelectionStart}"/>

                    <TextBlock Grid.Column="0" Grid.Row="1" Text="{Localizing End}"/>
                    <TextBlock Grid.Column="1" Grid.Row="1" Text="{Binding ActiveTextEditorView.SelectionEnd}"/>

                    <TextBlock Grid.Column="0" Grid.Row="2" Text="{Localizing Length}"/>
                    <TextBlock Grid.Column="1" Grid.Row="2" Text="{Binding ActiveTextEditorView.SelectionLength}" />

                </Grid>
            </GroupBox>

        </StackPanel>
    </ToolTip>

</ResourceDictionary>